bitkeeper revision 1.1159.1.488 (41c1acbbhUN0iUWmupmPB85ghWRehg)
authorkaf24@pb001.cl.cam.ac.uk <kaf24@pb001.cl.cam.ac.uk>
Thu, 16 Dec 2004 15:41:47 +0000 (15:41 +0000)
committerkaf24@pb001.cl.cam.ac.uk <kaf24@pb001.cl.cam.ac.uk>
Thu, 16 Dec 2004 15:41:47 +0000 (15:41 +0000)
Many files:
  x86/64 fixes.

13 files changed:
BitKeeper/etc/logging_ok
xen/arch/x86/Makefile
xen/arch/x86/boot/x86_64.S
xen/arch/x86/domain.c
xen/arch/x86/shadow.c
xen/arch/x86/x86_64/asm-offsets.c
xen/arch/x86/x86_64/usercopy.c
xen/include/asm-x86/config.h
xen/include/asm-x86/mm.h
xen/include/asm-x86/pda.h
xen/include/asm-x86/processor.h
xen/include/asm-x86/x86_32/current.h
xen/include/asm-x86/x86_64/current.h

index cbc3dd3c3e1f104bdf45530dffaa5bc2e27eb79b..c7daeeea4b768d13a9e3e48328b87dc540e35130 100644 (file)
@@ -27,6 +27,7 @@ jws@cairnwell.research
 kaf24@camelot.eng.3leafnetworks.com
 kaf24@freefall.cl.cam.ac.uk
 kaf24@labyrinth.cl.cam.ac.uk
+kaf24@pb001.cl.cam.ac.uk
 kaf24@penguin.local
 kaf24@plym.cl.cam.ac.uk
 kaf24@scramble.cl.cam.ac.uk
index 0062ce76784b08275b4c90e5d98988d123b18257..55603231a1641668526b61e09747bf56bc60577e 100644 (file)
@@ -12,6 +12,12 @@ OBJS += $(patsubst %.c,%.o,$(wildcard mtrr/*.c))
 
 OBJS := $(subst $(TARGET_SUBARCH)/asm-offsets.o,,$(OBJS))
 
+ifneq ($(TARGET_SUBARCH),i386)
+OBJS := $(subst vmx.o,,$(OBJS))
+OBJS := $(subst vmx_io.o,,$(OBJS))
+OBJS := $(subst vmx_vmcs.o,,$(OBJS))
+endif ($(TARGET_SUBARCH),i386)
+
 default: boot/$(TARGET_SUBARCH).o $(OBJS) boot/mkelf32
        $(LD) $(LDFLAGS) -r -o arch.o $(OBJS)
        $(LD) $(LDFLAGS) -T $(TARGET_SUBARCH)/xen.lds -N \
index a8253a4ce1adf74204138ed7cc5d88e4a70e7776..875584126e4ec86ad2490c858a02f0e2205e0510 100644 (file)
@@ -252,11 +252,14 @@ map_domain_mem:
 unmap_domain_mem:
 ret_from_intr:
 #undef machine_to_phys_mapping
+#undef phys_to_machine_mapping
 .globl copy_to_user, set_intr_gate, die, machine_to_phys_mapping
+.globl phys_to_machine_mapping
 copy_to_user:
 set_intr_gate:
 die:
 machine_to_phys_mapping:
+phys_to_machine_mapping:
 .globl copy_from_user, show_registers, do_iopl
 copy_from_user: 
 show_registers: 
index 646bbc3aa0a46b027f9dafee97f6da0c6677efd9..14f85f2687c432cdd7aef848c4bb39dd3f6dff0e 100644 (file)
@@ -61,7 +61,7 @@ static void default_idle(void)
         __sti();
 }
 
-static void idle_loop(void)
+void idle_loop(void)
 {
     int cpu = smp_processor_id();
     for ( ; ; )
index 24853764728e4534e35bfe29b821522920d06d49..58a6fffdc489f8286765561e470d4cef8d0ee482 100644 (file)
@@ -450,7 +450,7 @@ unsigned long shadow_l2_table(
 {
     struct pfn_info *spfn_info;
     unsigned long    spfn;
-    l2_pgentry_t    *spl2e = 0, *gpl2e;
+    l2_pgentry_t    *spl2e = 0;
     unsigned long guest_gpfn;
 
     __get_machine_to_phys(m, guest_gpfn, gpfn);
@@ -471,17 +471,19 @@ unsigned long shadow_l2_table(
  
 #ifdef __i386__
     /* Install hypervisor and 2x linear p.t. mapings. */
-    if (m->shadow_mode == SHM_full_32) 
+    if ( m->shadow_mode == SHM_full_32 )
+    {
         vmx_update_shadow_state(m, gpfn, spfn);
-    else {
+    }
+    else
+    {
         spl2e = (l2_pgentry_t *)map_domain_mem(spfn << PAGE_SHIFT);
-        // can't use the linear map as we may not be in the right PT
-        gpl2e = (l2_pgentry_t *) map_domain_mem(gpfn << PAGE_SHIFT);
         /*
-         * We could proactively fill in PDEs for pages that are already shadowed.
-         * However, we tried it and it didn't help performance. This is simpler.
+         * We could proactively fill in PDEs for pages that are already
+         * shadowed. However, we tried it and it didn't help performance.
+         * This is simpler.
          */
-        memset(spl2e, 0, DOMAIN_ENTRIES_PER_L2_PAGETABLE * sizeof(l2_pgentry_t));
+        memset(spl2e, 0, DOMAIN_ENTRIES_PER_L2_PAGETABLE*sizeof(l2_pgentry_t));
 
         /* Install hypervisor and 2x linear p.t. mapings. */
         memcpy(&spl2e[DOMAIN_ENTRIES_PER_L2_PAGETABLE], 
@@ -497,10 +499,8 @@ unsigned long shadow_l2_table(
     }
 #endif
 
-    if (m->shadow_mode != SHM_full_32) 
-    {                           
+    if ( m->shadow_mode != SHM_full_32 ) 
         unmap_domain_mem(spl2e);
-    }
 
     SH_VLOG("shadow_l2_table( %08lx -> %08lx)", gpfn, spfn);
     return spfn;
index 2e6c3b396eb0486167cd316bdbf5dd3f546ea99a..4ffe1dd6adefadd0e92382690bd290144c48afd8 100644 (file)
@@ -38,14 +38,14 @@ void __dummy__(void)
     OFFSET(XREGS_ss, struct xen_regs, ss);
     BLANK();
 
-    OFFSET(DOMAIN_processor, struct domain, processor);
-    OFFSET(DOMAIN_shared_info, struct domain, shared_info);
-    OFFSET(DOMAIN_event_sel, struct domain, thread.event_selector);
-    OFFSET(DOMAIN_event_addr, struct domain, thread.event_address);
-    OFFSET(DOMAIN_failsafe_sel, struct domain, thread.failsafe_selector);
-    OFFSET(DOMAIN_failsafe_addr, struct domain, thread.failsafe_address);
-    OFFSET(DOMAIN_trap_bounce, struct domain, thread.trap_bounce);
-    OFFSET(DOMAIN_thread_flags, struct domain, thread.flags);
+    OFFSET(EDOMAIN_processor, struct exec_domain, processor);
+    OFFSET(EDOMAIN_vcpu_info, struct exec_domain, vcpu_info);
+    OFFSET(EDOMAIN_event_sel, struct exec_domain, thread.event_selector);
+    OFFSET(EDOMAIN_event_addr, struct exec_domain, thread.event_address);
+    OFFSET(EDOMAIN_failsafe_sel, struct exec_domain, thread.failsafe_selector);
+    OFFSET(EDOMAIN_failsafe_addr, struct exec_domain, thread.failsafe_address);
+    OFFSET(EDOMAIN_trap_bounce, struct exec_domain, thread.trap_bounce);
+    OFFSET(EDOMAIN_thread_flags, struct exec_domain, thread.flags);
     BLANK();
 
     OFFSET(SHINFO_upcall_pending, shared_info_t, 
index e7c11fa50104febe443976f3ea89d9b62473c450..c060c45890c2ae18ddf7aa5155f4b404110ac925 100644 (file)
@@ -88,7 +88,7 @@ unsigned long __clear_user(void *addr, unsigned long size)
                "       .quad 1b,2b\n"
                ".previous"
                : [size8] "=c"(size), [dst] "=&D" (__d0)
-               : [size1] "r"(size & 7), "[size8]" (size / 8), "[dst] "(addr),
+               : [size1] "r"(size & 7), "[size8]" (size / 8), "[dst]"(addr),
                  [zero] "r" (0UL), [eight] "r" (8UL));
        return size;
 }
index 1ac2eb358a15e0cc827fd8ba8b20103c2c9783d1..8f89051872a895aa3af2bdf7ae35a876726227c6 100644 (file)
@@ -4,10 +4,13 @@
  * A Linux-style configuration list.
  */
 
-#ifndef __XEN_I386_CONFIG_H__
-#define __XEN_I386_CONFIG_H__
+#ifndef __X86_CONFIG_H__
+#define __X86_CONFIG_H__
 
+#ifdef __i386__
 #define CONFIG_VMX 1
+#endif
+
 #define CONFIG_X86 1
 
 #define CONFIG_SMP 1
@@ -228,4 +231,4 @@ extern unsigned long xenheap_phys_end; /* user-configurable */
 #define ELFSIZE 32
 #endif
 
-#endif /* __XEN_I386_CONFIG_H__ */
+#endif /* __X86_CONFIG_H__ */
index e392d588cadb43af966e9c2575615966f07a45d4..652084f117aecdb1d46bb2a5f1b12725424fb82e 100644 (file)
@@ -215,6 +215,7 @@ void synchronise_pagetables(unsigned long cpu_mask);
  * contiguous (or near contiguous) physical memory.
  */
 #undef  machine_to_phys_mapping
+
 /*
  * The phys_to_machine_mapping is the reversed mapping of MPT for full
  * virtualization.
@@ -223,12 +224,11 @@ void synchronise_pagetables(unsigned long cpu_mask);
 
 #ifdef __x86_64__
 extern unsigned long *machine_to_phys_mapping;
+extern unsigned long *phys_to_machine_mapping;
 #else
 #define machine_to_phys_mapping ((unsigned long *)RDWR_MPT_VIRT_START)
-#ifdef CONFIG_VMX
 #define phys_to_machine_mapping ((unsigned long *)PERDOMAIN_VIRT_START)
 #endif
-#endif
 
 #define DEFAULT_GDT_ENTRIES     (LAST_RESERVED_GDT_ENTRY+1)
 #define DEFAULT_GDT_ADDRESS     ((unsigned long)gdt_table)
index dcecc48f2086a3cf1d8a255f8c092a60d36660f7..42fa8be9b02b4a45d9e6155cd2fcc270a6f8ca1a 100644 (file)
@@ -9,7 +9,7 @@ struct x8664_pda {
        unsigned long kernelstack;  /* TOS for current process */ 
        unsigned long oldrsp;       /* user rsp for system call */
        unsigned long irqrsp;       /* Old rsp for interrupts. */ 
-       struct domain *pcurrent;        /* Current process */
+       struct exec_domain *pcurrent;   /* Current process */
         int irqcount;              /* Irq nesting counter. Starts with -1 */   
        int cpunumber;              /* Logical CPU number */
        char *irqstackptr;      /* top of irqstack */
index 9935c9b2b6bea537e58654340bed4d3f5e27f242..d7bd5ec4e45b573a517a9e1996be021dc7029a69 100644 (file)
@@ -478,17 +478,12 @@ struct mm_struct {
     l1_pgentry_t *perdomain_ptes;
     pagetable_t  pagetable;
 
-#ifdef CONFIG_VMX
-
-#define SHM_full_32     (8) /* full virtualization for 32-bit */
-
-        pagetable_t  monitor_table;
-        l2_pgentry_t *vpagetable;      /* virtual address of pagetable */
-        l2_pgentry_t *shadow_vtable;   /* virtual address of shadow_table */
-        l2_pgentry_t *guest_pl2e_cache;        /* guest page directory cache */
-        unsigned long min_pfn;         /* min host physical */
-        unsigned long max_pfn;         /* max host physical */
-#endif
+    pagetable_t  monitor_table;
+    l2_pgentry_t *vpagetable;  /* virtual address of pagetable */
+    l2_pgentry_t *shadow_vtable;       /* virtual address of shadow_table */
+    l2_pgentry_t *guest_pl2e_cache;    /* guest page directory cache */
+    unsigned long min_pfn;             /* min host physical */
+    unsigned long max_pfn;             /* max host physical */
 
     /* shadow mode status and controls */
     unsigned int shadow_mode;  /* flags to control shadow table operation */
index 99d7b4b0b3a861c86908655358f95a671b429cff..42d01ee1340e4bba73289bbaa68c10ad5d1e60fa 100644 (file)
@@ -6,20 +6,20 @@ struct domain;
 #define STACK_RESERVED \
     (sizeof(execution_context_t) + sizeof(struct domain *))
 
-static inline struct exec_domain * get_current(void)
+static inline struct exec_domain *get_current(void)
 {
-    struct exec_domain *current;
+    struct exec_domain *ed;
     __asm__ ( "orl %%esp,%0; andl $~3,%0; movl (%0),%0" 
-              : "=r" (current) : "0" (STACK_SIZE-4) );
-    return current;
+              : "=r" (ed) : "0" (STACK_SIZE-4) );
+    return ed;
 }
  
 #define current get_current()
 
-static inline void set_current(struct exec_domain *p)
+static inline void set_current(struct exec_domain *ed)
 {
     __asm__ ( "orl %%esp,%0; andl $~3,%0; movl %1,(%0)" 
-              : : "r" (STACK_SIZE-4), "r" (p) );    
+              : : "r" (STACK_SIZE-4), "r" (ed) );    
 }
 
 static inline execution_context_t *get_execution_context(void)
index 2ee550643b989ad48ed76283860357e7f33f34b4..576e19c112f2f0b964b63c7cd65dc5e9d81a657d 100644 (file)
@@ -9,18 +9,18 @@ struct domain;
 #define STACK_RESERVED \
     (sizeof(execution_context_t))
 
-static inline struct domain * get_current(void)
+static inline struct exec_domain *get_current(void)
 {
-    struct domain *current;
-    current = read_pda(pcurrent);
-    return current;
+    struct exec_domain *ed;
+    ed = read_pda(pcurrent);
+    return ed;
 }
  
 #define current get_current()
 
-static inline void set_current(struct domain *p)
+static inline void set_current(struct exec_domain *ed)
 {
-    write_pda(pcurrent,p);
+    write_pda(pcurrent, ed);
 }
 
 static inline execution_context_t *get_execution_context(void)